package asn.match.model;

// Generated 15 juin 2014 03:03:18 by Hibernate Tools 4.0.0

import java.util.Date;
import java.util.HashSet;
import java.util.Set;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;

import static javax.persistence.GenerationType.IDENTITY;

import javax.persistence.CascadeType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 * Comment generated by hbm2java
 */
@SuppressWarnings("serial")
@Entity
@Table(name = "comment", catalog = "muslima_sphere")
public class Comment implements java.io.Serializable {

	private Integer idComment;
	private Comment comment;
	private Ressource ressource;
	private String opinion;
	private String status;
	private Date createdAt;
	private Date modifiedAt;
	private Set<CommentLike> commentLikes = new HashSet<CommentLike>(0);
	private Set<Comment> comments = new HashSet<Comment>(0);

	public Comment() {
	}

	public Comment(Ressource ressource, String opinion, String status,
			Date createdAt, Date modifiedAt) {
		this.ressource = ressource;
		this.opinion = opinion;
		this.status = status;
		this.createdAt = createdAt;
		this.modifiedAt = modifiedAt;
	}

	public Comment(Comment comment, Ressource ressource, String opinion,
			String status, Date createdAt, Date modifiedAt,
			Set<CommentLike> commentLikes, Set<Comment> comments) {
		this.comment = comment;
		this.ressource = ressource;
		this.opinion = opinion;
		this.status = status;
		this.createdAt = createdAt;
		this.modifiedAt = modifiedAt;
		this.commentLikes = commentLikes;
		this.comments = comments;
	}

	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "id_comment", unique = true, nullable = false)
	public Integer getIdComment() {
		return this.idComment;
	}

	public void setIdComment(Integer idComment) {
		this.idComment = idComment;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "parent_comment_id")
	public Comment getComment() {
		return this.comment;
	}

	public void setComment(Comment comment) {
		this.comment = comment;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "ressource_id", nullable = false)
	public Ressource getRessource() {
		return this.ressource;
	}

	public void setRessource(Ressource ressource) {
		this.ressource = ressource;
	}

	@Column(name = "opinion", nullable = false, length = 65535)
	public String getOpinion() {
		return this.opinion;
	}

	public void setOpinion(String opinion) {
		this.opinion = opinion;
	}

	@Column(name = "status", nullable = false, length = 16)
	public String getStatus() {
		return this.status;
	}

	public void setStatus(String status) {
		this.status = status;
	}

	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "created_at", nullable = false, length = 19)
	public Date getCreatedAt() {
		return this.createdAt;
	}

	public void setCreatedAt(Date createdAt) {
		this.createdAt = createdAt;
	}

	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "modified_at", nullable = false, length = 19)
	public Date getModifiedAt() {
		return this.modifiedAt;
	}

	public void setModifiedAt(Date modifiedAt) {
		this.modifiedAt = modifiedAt;
	}

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "comment", cascade={CascadeType.PERSIST,CascadeType.REMOVE})
	public Set<CommentLike> getCommentLikes() {
		return this.commentLikes;
	}

	public void setCommentLikes(Set<CommentLike> commentLikes) {
		this.commentLikes = commentLikes;
	}

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "comment", cascade={CascadeType.PERSIST,CascadeType.REMOVE})
	public Set<Comment> getComments() {
		return this.comments;
	}

	public void setComments(Set<Comment> comments) {
		this.comments = comments;
	}

}
